﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;

/// <summary>
/// 分解参数的父类
/// </summary>
public class PSplitParameters : System.Web.UI.UserControl
{
    public PSplitParameters()
    {
        
    }

    #region 成员    
    protected string valueQuerys = string.Empty;        
    #endregion

    #region 属性    
    /// <summary>
    /// 默认值和参数索引集合(武汉|0,女性|1)
    /// </summary>
    public string ValueQuerys
    {
        set { valueQuerys = value; }
    }
    
    #endregion

    #region 方法
    /// <summary>
    /// 获取匹配参数
    /// </summary>
    /// <returns></returns>
    protected string[] GetMatchParas()
    {
        string[] tagParas = null; //标签的外来参数
        //获取路径参数
        string[] urlquery = null;
        UIMethod.GetQuery(ref urlquery, UIMethod.UI_parameters);
        //过滤参数
        ArrayList paras = UIMethod.SplitParameters(valueQuerys);
        try
        {
            tagParas = new string[paras.Count];
            for (int i = 0; i < paras.Count; i++)
            {
                string[] vals = (string[])paras[i];
                string defaultvalue = vals[0];  //默认值
                try
                {
                    int queryindex = Convert.ToInt32(vals[1]);    //参数索引                
                    tagParas[i] = urlquery[queryindex];
                }
                catch { tagParas[i] = vals[0].Trim(); }
            }
        }
        catch { }

        return tagParas;
    }
    #endregion
}
